Field of the Invention
Embodiments of the present invention generally relate to software interoperability and compatibility and, more particularly, to a method and apparatus for translating JAVASCRIPT code across different host environments.
Description of the Related Art
JAVASCRIPT is a popular client-side scripting language that is used in various host environments such as ADOBE® ACROBAT®, a user's web browser, and the like. JAVASCRIPT® code can enhance a HyperText Markup Language (HTML) web page or a Portable Document Format (PDF) document so that it contains dynamic form fields, can dynamically alter displayed document content, dynamically capture user-entered data, as well as other dynamic interactions with a user, such as display buttons to initiate user actions. Hence, an author may customize the behavior of a PDF document or rendered web page with JAVASCRIPT code so as to make the PDF document or web page highly dynamic. For example, when a user opens a PDF document that includes JAVASCRIPT code using ADOBE ACROBAT, and then the user interacts with the PDF document, ACROBAT monitors the user interaction and executes the appropriate JAVASCRIPT code.
When a PDF document that includes JAVASCRIPT code is rendered on a web page in a web browser, the PDF document is converted to HyperText Markup Language (HTML), which is able to be interpreted by the web browser. However, although ACROBAT JAVASCRIPT code and Browser JAVASCRIPT code are the same language, the two are of different dialects. The two dialects have a common language foundation, identical grammar, and have common core JAVASCRIPT code objects. The difference lies in the use of different extension objects and different Application Programming Interfaces (APIs). As a result, when the PDF document is converted to HTML, the JAVASCRIPT code is lost in translation and the dynamic content portion of the PDF document is reduced to static content.
Currently, a PDF reader must be placed on each web browser in order to translate the JAVASCRIPT code so as to maintain the interactive nature of the PDF document content. However, supporting all browser platforms is cost and time prohibitive. In addition, mobile platforms restrict the implementation of a full-fledged PDF reader. Even furthermore, iOS (the APPLE® Operating System) does not even allow a scripting engine inside of an application. Thus, ACROBAT JAVASCRIPT code cannot run on iOS.
Therefore, there is a need for a method and apparatus for translating JAVASCRIPT code across different host environments.